package com.student_system.common;

import lombok.Data;

public class Result {
    @Data
    public static class ResultData<T> {
        private String code;
        private String msg;
        private T data;
    }
    public static <T> ResultData<T> success(T data) {
        ResultData<T> result = new ResultData<>();
        result.setCode("200");
        result.setMsg("success");
        result.setData(data);
        return result;
    }
    public static <T> ResultData<T> success() {
        return success(null);
    }
    public static <T> ResultData<T> error(String code,String msg) {
        ResultData<T> result = new ResultData<>();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }
}
